<%-- 
    Document   : user_main
    Created on : Nov 19, 2008, 11:51:29 PM
    Author     : Vyor
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<h3>Users</h3>
<table>
    <tr>
        <td class="menucon">
            <html:link action="/usr_presave.do">New User</html:link>
        </td>
        <td class="menucon">
            <html:link action="/usr_initdata.do" title="Find certain user">Find User</html:link>
        </td>
    </tr>
</table>
<html:messages id="messages" property="customMessage" message="true">
    <div class="heading4"><bean:write name="messages"/></div>
</html:messages>
<html:errors/>
<html:messages id="messages" property="message" message="true">
    <ul>
        <li><bean:write name="messages"/></li>
    </ul>
</html:messages>
<table>
    <tr class="table_header">
        <th>No.</th>
        <th>UserName</th>
        <th>Name</th>
        <th>Address</th>
        <th>Phone</th>
        <th>Department</th>
        <th>Cabang</th>
        <th>Actions</th>
    </tr>
    <c:set var="x" value="0"/>
    <c:forEach items="${users}" var="user">
        <tr>
            <td>${x+1}.</td>
            <td>${user.username}</td>
            <td>${user.nama}</td>
            <td>${user.alamat}</td>
            <td>${user.telp}</td>
            <td><html:link title="See all user in ${user.departemen.nama} department." action="/usr_getusersbydept?id=${user.departemen.id}">${user.departemen.nama}</html:link></td>
            <td><html:link title="See all user in ${user.cabang.kota}." action="/usr_getusersbycabang.do?id=${user.cabang.id}">${user.cabang.kota}</html:link></td>
            <td>
                <html:link action="/usr_getuser.do?id=${user.id}">Detail</html:link>
                <html:link action="/usr_preupdate.do?id=${user.id}">Edit</html:link>
                <html:link action="/usr_delete.do?id=${user.id}">Delete</html:link>
            </td>            
        </tr>
        <c:set var="x" value="${x+1}"/>
    </c:forEach>
        <tr class="table_footer">
            <td colspan="10">PT. Dhemar Nusantara - PT. Rahmi Ida Nusantara</td>
        </tr>
</table>
